package com.risetechnology.customviews;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.risetechnology.data.Recipe;

public class CustomSlideImageView extends ImageView{

	private int index = 0;
	private ArrayList<Recipe> recipes;
	public CustomSlideImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		
	}
	
	public void nextImage(){
		if(null != recipes && recipes.size()>0){
			index++;
			if(index>=recipes.size()) index = 0;
			Drawable dr = recipes.get(index).getImage();
			this.setImageDrawable(dr);
		}
	}
	
	/**
	 * @return the recipes
	 */
	public ArrayList<Recipe> getRecipes() {
		return recipes;
	}
	/**
	 * @param recipes the recipes to set
	 */
	public void setRecipes(ArrayList<Recipe> recipes) {
		this.recipes = recipes;
	}
}
